<template>
	<view class="page">
		<CustomNav :isBack="false" color="#fff" :topBgColor="topBgColor" title="肃州种子"></CustomNav>
		<view class="search-block" :style="'margin-top:'+mt">
			<input class="search-input" placeholder-class="inputPlaceholder" placeholder="请输入关键字" />
			<view class="search-btn">搜索</view>
		</view>
		<swiper class="swiper" style="margin: 20rpx auto;">
			<swiper-item style="width: 100%;height: 100%;" v-for="item in swiper" :key="item.id">
				<image :src="item.img" style="width: 100%;height: 100%;border-radius: 20rpx;"
					@click="navigate(item.url)">
				</image>
			</swiper-item>
		</swiper>
		<view class="menu-block" v-if="audit===2">
			<view @click="navigate(item.url)" class="menu-item" v-for="item in passMenu" :key="item.id">
				<image class="menu-icon" :src="item.icon"></image>
				<view class="menu-name">{{item.name}}</view>
			</view>
		</view>
		<view class="menu-block" v-else>
			<view @click="navigate(item.url)" class="menu-item" v-for="item in menu" :key="item.id">
				<image class="menu-icon" :src="item.icon"></image>
				<view class="menu-name">{{item.name}}</view>
			</view>
		</view>
		<view class="township-block">
			<view class="title FZHZGBJ">肃州乡镇</view>
			<view class="township-item">
				<view class="township-list" v-for="item in townshipList" :key="item.id"
					@click="navigate('/page_pack/code/code?img='+item.image+'&title='+item.name)">
					<image class="township-icon" :src="item.icon"></image>
					<view class="township-name">{{item.name}}</view>
				</view>
			</view>
		</view>
		<image @click="navigate('/page_pack/classroom/index')" style="margin: 20rpx auto;" class="banner"
			mode="widthFix"
			src="https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/banner3.png"></image>
		<view class="list-title">
			<view class="title FZHZGBJ">种业资讯</view>
			<!-- <view class="more">更多</view> -->
		</view>
		<view class="list">
			<view class="list-item" v-for="item in list" :key="item.id"
				@click="navigate('/page_pack/article/article?id='+item.id)">
				<image :src="item.cover" class="cover-image" mode="aspectFill"></image>
				<view class="info">
					<view class="title">{{item.title}}</view>
					<view class="time">{{item.time}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		queryApprovalStatus
	} from '@/api/entrepreneurship';
	export default {
		components: {},
		data() {
			return {
				audit: 1,
				topBgColor: 'rgba(0,0,0,0)',
				swiper: [{
						id: 1,
						img: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/swiper.png',
						url: '/page_pack/products/products?type=2'
					},
					{
						id: 2,
						img: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/banner2.png',
						url: '/page_pack/products/products?type=1'
					},
				],
				menu: [{
						id: 2,
						name: '种子集市',
						icon: '/static/images/menu2.png',
						url: '/page_pack/seed_market/index'
					},
					{
						id: 3,
						name: '产业地图',
						icon: '/static/images/menu3.png',
						url: '/page_pack/map/map'
					},
					{
						id: 1,
						name: '品牌农产品',
						icon: '/static/images/menu1.png',
						url: '/page_pack/products/products?type=1'
					},
					{
						id: 4,
						name: '招工用工',
						icon: '/static/images/menu4.png',
						url: '/page_pack/recruitment/recruitment'
					},
					{
						id: 5,
						name: '招商引资',
						icon: '/static/images/menu5.png',
						url: '/page_pack/investment/list'
					},
					{
						id: 6,
						name: '创业蓝海',
						icon: '/static/images/menu7.png',
						url: '/page_pack/entrepreneurship/enter'
					}
				],
				passMenu: [{
						id: 2,
						name: '种子集市',
						icon: '/static/images/menu2.png',
						url: '/page_pack/seed_market/index'
					},
					{
						id: 3,
						name: '产业地图',
						icon: '/static/images/menu3.png',
						url: '/page_pack/map/map'
					},
					{
						id: 1,
						name: '品牌农产品',
						icon: '/static/images/menu1.png',
						url: '/page_pack/products/products?type=1'
					},
					{
						id: 4,
						name: '招工用工',
						icon: '/static/images/menu4.png',
						url: '/page_pack/recruitment/recruitment'
					},
					{
						id: 5,
						name: '招商引资',
						icon: '/static/images/menu5.png',
						url: '/page_pack/investment/list'
					},
					{
						id: 6,
						name: '大美肃州',
						icon: '/static/images/menu6.png',
						url: '/page_pack/motion_video/index'
					},
					{
						id: 7,
						name: '创业蓝海',
						icon: '/static/images/menu7.png',
						url: '/page_pack/entrepreneurship/enter'
					},
					{
						id: 8,
						name: '优选直播间',
						icon: '/static/images/menu8.png',
						url: '/page_pack/live/live'
					},
				],
				list: [{
						id: 1,
						title: '2024年度玉米种子企业信用等级评价结果',
						time: '2024-04-07',
						cover: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/article-cover.png'
					},
					{
						id: 2,
						title: '甘肃省委省政府发布重要实施意见！',
						time: '2024-04-07',
						cover: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/article-cover.png'
					},
					{
						id: 3,
						title: '温馨提示－种子购买注意事项',
						time: '2024-04-07',
						cover: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/article-cover.png'
					},
				],
				townshipList: [{
						id: 1,
						name: '西洞镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/1%E8%A5%BF%E6%B4%9E.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/1%E8%A5%BF%E6%B4%9E.png'
					}, {
						id: 2,
						name: '清水镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/2%E6%B8%85%E6%B0%B4%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/2%E6%B8%85%E6%B0%B4%E9%95%87.png'
					},
					{
						id: 3,
						name: '总寨镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/3%E6%80%BB%E5%AF%A8%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/3%E6%80%BB%E5%AF%A8%E9%95%87.png'
					},
					{
						id: 4,
						name: '金佛寺镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/4%E9%87%91%E4%BD%9B%E5%AF%BA%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/4%E9%87%91%E4%BD%9B%E5%AF%BA.png'
					},
					{
						id: 6,
						name: '上坝镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/5%E4%B8%8A%E5%9D%9D%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/5%E4%B8%8A%E5%9D%9D%E9%95%87.png'
					},
					{
						id: 7,
						name: '三墩镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/6%E4%B8%89%E5%A2%A9%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/6%E4%B8%89%E5%A2%A9.png'
					},
					{
						id: 8,
						name: '银达镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/7%E9%93%B6%E8%BE%BE%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/7%E9%93%B6%E8%BE%BE.png'
					},
					{
						id: 9,
						name: '西峰镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/8%E8%A5%BF%E5%B3%B0%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/8%E8%A5%BF%E5%B3%B0.png'
					},
					{
						id: 10,
						name: '泉湖镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/9%E6%B3%89%E6%B9%96%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/9%E6%B3%89%E6%B9%96.png'
					}, {
						id: 11,
						name: '果园镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/10%E6%9E%9C%E5%9B%AD%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/10%E6%9E%9C%E5%9B%AD.png'
					},
					{
						id: 12,
						name: '下河清镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/11%E4%B8%8B%E6%B2%B3%E6%B8%85%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/11%E4%B8%8B%E6%B2%B3%E6%B8%85.png'
					},
					{
						id: 13,
						name: '铧尖镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/12%E9%93%A7%E5%B0%96%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/12%E9%93%A7%E5%B0%96.png'
					},
					{
						id: 14,
						name: '东洞镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/13%E4%B8%9C%E6%B4%9E%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/13%E4%B8%9C%E6%B4%9E.png'
					}, {
						id: 15,
						name: '丰乐镇',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/14%E4%B8%B0%E4%B9%90%E9%95%87.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/14%E4%B8%B0%E4%B9%90.png'
					},
					{
						id: 16,
						name: '黄泥堡乡',
						icon: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/15%E9%BB%84%E6%B3%A5%E5%A0%A1%E4%B9%A1.png',
						image: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/township/scan/15%E9%BB%84%E6%B3%A5%E5%A0%A1.png'
					}
				]
			}
		},
		watch: {

		},
		methods: {
			queryVertify() {
				queryApprovalStatus().then(res => {
					if (res) {
						this.audit = res.status
					}
				})
			},
			//onShareAppMessage 分享给朋友
			onShareAppMessage: function(res) {
				if (res.from === 'button') {

				}
				return {
					title: '酒泉金质种子',
					path: '/pages/index/index'
				}
			},
			onShareTimeline() { // 分享到朋友圈
				return {
					title: '酒泉金质种子',
					path: '/pages/index/index'
				}
			},
		},
		onLoad() {
			this.queryVertify()
		}
	}
</script>

<style lang="scss">
	.page {
		overflow: hidden;
		height: 100%;
		background-image: linear-gradient(to bottom, #68C759, #F8F8F8 400px, #F8F8F8 400px, #F8F8F8);
		background-repeat: no-repeat;

		.search-block {
			width: $content-width;
			margin: 0 auto;
			height: 70rpx;
			background: #fff;
			border-radius: 18px;
			padding: 6rpx;
			display: flex;

			.search-btn {
				width: 130rpx;
				height: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #fff;
				border-radius: 18px;
				font-size: 28rpx;
				background: $theme-color;
			}

			.search-input {
				height: 100%;
				flex-grow: 1;
				margin-left: 20rpx;
				font-size: 28rpx;
			}
		}

		.swiper {
			width: $content-width;
		}

		.banner {
			width: $content-width;
		}

		.township-block {
			width: $content-width;
			margin: 30rpx auto;
			background: #fff;
			padding: 30rpx;

			.title {
				color: #66BD59;
				margin-bottom: 20rpx;
			}

			.township-item {
				display: flex;
				align-items: center;
				overflow-x: scroll;

				.township-list {
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					margin-right: 30rpx;

					.township-icon {
						width: 110rpx;
						height: 110rpx;
						margin-bottom: 10rpx;
					}

					.township-name {
						font-size: 24rpx;
					}
				}
			}


		}

		.menu-block {
			width: $content-width;
			margin: 0 auto;
			background: #fff;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-radius: 10px;
			padding: 30rpx 20rpx;
			flex-wrap: wrap;

			.menu-item {
				width: 25%;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				margin-bottom: 20rpx;

				.menu-icon {
					width: 80rpx;
					height: 80rpx;
					margin-bottom: 10rpx;
				}

				.menu-name {
					font-size: 24rpx;
				}
			}
		}

		.list-title {
			display: flex;
			width: $content-width;
			margin: 0 auto;
			margin-bottom: 20rpx;

			.title {
				color: $theme-color;
				flex-grow: 1;
			}

			.more {
				font-size: 28rpx;
				color: #999;
			}
		}

		.list {
			width: $content-width;
			margin: 0 auto;

			.list-item {
				width: 100%;
				background: #fff;
				border-radius: 10px;
				display: flex;
				align-items: center;
				padding: 20rpx;
				height: 180rpx;
				margin-bottom: 20rpx;

				.cover-image {
					width: 140rpx;
					height: 140rpx;
					border-radius: 8px;
				}

				.info {
					width: calc(100% - 160rpx);
					height: 100%;
					margin-left: 20rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.title {
						width: 100%;
						text-overflow: ellipsis;
						overflow: hidden;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						white-space: normal;
					}

					.time {
						font-size: 28rpx;
						color: #999;
					}
				}
			}
		}
	}
</style>